After continued development and a strong focus on improving the integration between CodeBehind and WebForms Core, Elanat has released CodeBehind version 4.7.
This release introduces several important architectural and structural improvements designed to provide better support for WebForms Core technology, simplify MVC development, improve request processing, and increase overall framework stability.
CodeBehind 4.7 also includes an upgrade to WebForms Core version 2.1. WebForms Core 2.1 is a major update that introduces high-level capabilities and advanced features, representing another important step in the evolution of WebForms Core technology.
Features of Version 4.7
CodeBehindConstructor Merged into the PageLoad Method
In CodeBehind version 4.7, the CodeBehindConstructor method has been completely removed and its functionality has been integrated into the PageLoad method.
This change has been made to simplify the MVC development pattern and provide a more unified structure for Controllers and Models.
With the new structure, a standard Controller uses PageLoad without parentheses when it is invoked with the context.
For Models, when the Abstract option is enabled, omitting parentheses after the Model name automatically causes the context to be passed to the Model.
For non-Abstract Models defined inside triple braces, parentheses are taken into consideration when determining the method invocation. If parentheses are not specified, the PageLoad method will not be executed.
This change simplifies the MVC structure and makes initialization behavior more consistent across Controllers and Models.
Write Output Added After the View
Starting with CodeBehind version 4.7, data added to the response through the Write method in Controllers and Models is placed after the View output.
This change has been introduced to improve compliance with HTML standards. A standard HTML document begins with the
declaration, and placing additional output before the View can result in content being written before the expected HTML document structure.
The new behavior also provides better compatibility with WebForms Core in situations where HTML is sent together with Action Control data.
By placing Write output after the View, CodeBehind provides a cleaner response structure and better coordination between View rendering and WebForms Core processing.
Automatic Content-Type for PostBack Requests
A new configuration option named SetTextHtmlContentTypeForPostBack has been introduced to automatically set the response Content-Type header for PostBack requests.
When enabled, the response Content-Type is set to:
text/html; charset=utf-8
This provides more consistent response handling for PostBack requests and improves compatibility with WebForms Core responses that contain HTML content.
The corresponding configuration option is:
set_text_html_content_type_for_post_back=true
Separate DLL and View Paths
CodeBehind 4.7 introduces a new structure that separates the path used for DLL files from the path used for View files.
DLL files can now be stored in a location independent of the View directory. This provides greater flexibility when organizing application files and makes it possible to keep View files inside the wwwroot directory while storing compiled DLL files in a separate and more secure location.
Two new configuration options have been added to manage DLL paths.
The dll_path option specifies the directory used for DLL files.
The move_dll_from_wwwroot_bin option determines whether DLL files generated in the wwwroot/bin directory should automatically be moved to the configured DLL directory after View files are recompiled.
This separation improves application structure and provides a better distinction between publicly accessible web resources and compiled application components.
Fixed Concurrent Initial View Compilation Requests
An issue related to concurrent initial requests during the creation and compilation of View files has been resolved.
Previously, multiple requests arriving while View files were being created or compiled could result in concurrency-related problems.
The internal handling of this process has been improved to provide more reliable behavior when multiple requests reach the application during initial View compilation.
Improved Form Data Handling
CodeBehind 4.7 introduces an improvement to the way Form data is accessed from incoming requests.
Form data should now be accessed only after verifying that the request contains Form content through HasFormContentType.
This change improves request processing and prevents unnecessary attempts to read Form data from requests that do not contain Form content.
For easier and safer access, CodeBehind also provides the IfForm extension method, allowing Form data to be conditionally accessed through a simplified structure.
This provides a more convenient approach for applications that need to handle different types of incoming requests.
Improved Request Management and Framework Stability
The request management system has been improved through the use of more advanced internal mechanisms designed to prevent unexpected framework failures.
These improvements strengthen the handling of concurrent and complex requests and reduce the possibility of framework crashes caused by problematic request conditions.
The changes provide a more stable execution environment and improve the overall reliability of CodeBehind applications.
The middleware and related classes responsible for WebSocket and Server-Sent Events (SSE) have been completely rewritten.
This is a significant internal improvement to the real-time communication infrastructure of CodeBehind.
The rewritten implementation provides better internal coordination, improved request and connection management, and a stronger foundation for WebSocket and SSE communication.
This change also improves the compatibility and integration of real-time communication with the latest WebForms Core architecture.
WebForms Core Technology Upgraded to Version 2.1
CodeBehind 4.7 includes an upgrade to WebForms Core version 2.1.
WebForms Core 2.1 is a major update that introduces advanced capabilities and high-level features, continuing the architectural evolution introduced with WebForms Core version 2.
This upgrade provides closer coordination between CodeBehind and WebForms Core and expands the capabilities available when building applications using the two technologies together.
WebForms Core 2.1 further develops the client-side execution architecture and provides new capabilities for building complex interactive web applications while maintaining the command-driven approach of WebForms Core.
Additional information about the features and capabilities introduced in WebForms Core version 2.1 will be published separately.
CodeBehind 4.7 also includes several additional internal improvements focused on performance, stability, request processing, and compatibility with WebForms Core.
Together, these changes improve the overall architecture of the framework and provide a more reliable foundation for applications built with CodeBehind.
CodeBehind 4.7 represents an important step in the continued development of the framework, with a particular focus on simplifying MVC development, improving HTML standards compliance, strengthening request handling, separating application components, and providing deeper integration with WebForms Core.
CodeBehind on GitHub:
https://github.com/elanatframework/Code_behind
Get CodeBehind from NuGet:
https://www.nuget.org/packages/CodeBehind/
CodeBehind page: